
/*
 * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
 *
 * (b)  If this Sample Code is distributed as part of the Display PostScript
 *	System Software Development Kit from Adobe Systems Incorporated,
 *	then this copy is designated as Development Software and its use is
 *	subject to the terms of the License Agreement attached to such Kit.
 *
 * (c)  If this Sample Code is distributed independently, then the following
 *	terms apply:
 *
 * (d)  This file may be freely copied and redistributed as long as:
 *	1) Parts (a), (d), (e) and (f) continue to be included in the file,
 *	2) If the file has been modified in any way, a notice of such
 *      modification is conspicuously indicated.
 *
 * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
 *	Adobe Systems Incorporated.
 * 
 * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
 *	CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
 *	AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
 *	ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
 *	OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
 *	WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
 *	WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
 *	DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
 *	FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
 *	OF THIRD PARTY RIGHTS.
 */

/*
*	Preferences.m
*
*	This subclass of the panel class sets the preferences.
*/

#import "Preferences.h"
#import "ImportApp.h"

#import <appkit/Button.h>
#import <appkit/Control.h>
#import <dpsclient/wraps.h>

#import <math.h>

@implementation Preferences

- drawHitSetting:sender
{
	float			hitSetting;

	NXRect		bounds, rect;

 	hitSetting = [sender  floatValue];
	[settingId  lockFocus];
		[settingId  getBounds:&bounds];
		PSsetgray(NX_LTGRAY);
		NXRectFill(&bounds);

		PSsetgray(NX_DKGRAY);
		NXSetRect(&rect, floor((bounds.size.width - hitSetting)/2), 
				floor((bounds.size.height - hitSetting)/2),
				rint(hitSetting), rint(hitSetting));
		NXRectFill(&rect);
	[settingId  unlockFocus];
	[self  flushWindow];

	return self;
}

- makeKeyAndOrderFront:sender
{
	[super  makeKeyAndOrderFront:sender];
	[self  drawHitSetting:sensitivityId];

	return self;
}

- orderOut:sender
{
	[super  orderOut:sender];

	[NXApp  setImagingFlag:imagingId];
	[NXApp  setHitSetting:sensitivityId];

	return self;
}

@end
